package utstat;

import utstat.listeners.Player;

public class Swap {

	private Player redPlayer;
	private Player bluePlayer;

	public Swap(Player b, Player r) {
		this.bluePlayer = b;this.redPlayer = r;
	}

	

	protected int getScoreOffset() {
		if(bluePlayer==null&&redPlayer==null) return 0;
		if(bluePlayer==null) return redPlayer.getScore();
		if(redPlayer==null) return -bluePlayer.getScore();		
		return redPlayer.getScore()-bluePlayer.getScore();
	}

	public String toString() {
		return "swap "+redPlayer+" for "+bluePlayer+" ("+getScoreOffset()+")";
	}
	
	public Player getRedPlayer() {
		return redPlayer;
	}

	public void setRedPlayer(Player redPlayer) {
		this.redPlayer = redPlayer;
	}

	public Player getBluePlayer() {
		return bluePlayer;
	}

	public void setBluePlayer(Player bluePlayer) {
		this.bluePlayer = bluePlayer;
	}
	
}
